<div class="row">

    <div class="col-md-8">      		
    	
    	<div class="widget stacked ">
    		
    		<div class="widget-header">
    			<i class="icon-user"></i>
    			<h3><?php echo isset($title_for_layout)?$title_for_layout:$this->l('Translation'); ?></h3>
    		</div> <!-- /widget-header -->
    		
    		<div class="widget-content">
                        
                <div class="block_option">
                	<h2 class="title_block"><?php echo $this->l('Develop/reduce blocks'); ?></h2>
                    <p class="block_option_content">
            			&gt; <label onclick="javascript:$('.block_content').slideDown('slow');"><?php echo $this->l('Develop all blocks'); ?></label><br />
            			&gt; <label onclick="javascript:$('.block_content').slideUp('slow');"><?php echo $this->l('Reduce all blocks'); ?></label>
            		</p>
                </div>
                <div class="clear"></div>
    			
    		</div> <!-- /widget-content -->
    			
    	</div> <!-- /widget -->
        
        <form action="<?php echo base_url('Cpannel/Translation/Translate/').(isset($iso_code)?('?iso_code='.$iso_code):''); ?>" method="post" role="form">
        
            <input type="hidden" name="iso_code" value="<?php echo $iso_code; ?>" />
                            
            <?php foreach ($fields as $controller => $actions): ?>
        	<div class="widget stacked ">
        		
        		<div class="widget-header">
        			<i class="icon-flag"></i>
        			<h3>
                        <strong>
                        <?php echo $this->l('Translation for the controller').' : '; ?>
                        </strong>
                        <?php echo $controller ; ?>
                    </h3>
        		</div> <!-- /widget-header -->
        		
        		<div class="widget-content">
	
                    <?php foreach ($actions as $file => $list): ?>
                    <fieldset class="block_lang">
                        <legend class="block_head" onclick="javascript:$('#content_<?php echo md5($file); ?>').slideToggle('slow');">
                            <strong>
                            <?php if (strpos($file, '.php')) : ?>
                                <?php echo $this->l('View').' : '; ?>
                            <?php else : ?>
                                <?php echo $this->l('Controller').' : '; ?>
                            <?php endif; ?>
                            </strong>
                            <?php echo $file.' ('. count($list) .')' ; ?>
                        </legend>
                        <div class="block_content" id="content_<?php echo md5($file); ?>">
                        <?php foreach ($list as $txt => $t): ?>
                    		<div class="form-group">
            					<label for="input<?php echo 'translation['.$file.md5($txt).']'; ?>" class="col-md-10"><?php echo stripcslashes($txt); ?></label>
            					
                                <div class="form-group col-md-10 input">
                                <?php if (strlen($txt) <= 63) : ?>
                                    <input type="text" name="<?php echo 'translation['.$file.md5($txt).']'; ?>" value="<?php echo set_value('translation['.$file.md5($txt).']', $t['trad']); ?>" class="form-control" id="<?php echo $file.md5($txt); ?>" data-default="<?php echo stripcslashes($txt); ?>" />
                       		    <?php else : ?>
                                    <textarea name="<?php echo 'translation['.$file.md5($txt).']'; ?>" class="form-control" id="<?php echo $file.md5($txt); ?>" data-default="<?php echo stripcslashes($txt); ?>" rows="3"><?php echo set_value('translation['.$file.md5($txt).']', $t['trad']); ?></textarea>
                                <?php endif; ?>
                                <?php if (!empty($t['use_sprintf'])) : ?>
                                    <p class="help-block"><?php echo $this->l('This text has a parameter to be set dynamically. Please keep %x in the traduction, where x can be \'s\', \'d\', \'f\' or more other.'); ?></p>
                                <?php endif; ?>
                                </div> <!-- /controls -->
                            </div>
                        <?php endforeach; ?>
                        </div>
                    </fieldset>
                    <?php endforeach; ?>
                    
        		</div> <!-- /widget-content -->
        			
        	</div> <!-- /widget -->
            <?php endforeach; ?>
                    
            <div class="clear"></div>
            
			<div class="form-horizontal form-group col-md-12" style=" padding: 0; ">
				<div class="col-md-offset-8 col-med-4">
					<button type="submit" class="btn btn-primary" name="btn_submit"><?php echo $this->l('Save updates'); ?></button> 
                    <a class="btn btn-default" href="<?php echo base_url('Cpannel/Translation/Listing'); ?>"><?php echo $this->l('Cancel'); ?></a>
				</div>
			</div>
                    
        </form>
    	
    </div> <!-- /span8 -->
    
    
    <div class="col-md-4">

        <div class="well">
        
        	<h4><?php echo $this->l('Extra Info'); ?></h4>
        
        	<p><?php echo $this->l('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'); ?></p>
        		
        		
        	<p><?php echo $this->l('Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'); ?></p>
        </div>
    					
    </div> <!-- /span4 -->

</div> <!-- /row -->


<script type="text/javascript" src="<?php echo base_url('webroot/js/jquery/jquery-1.9.1.min.js'); ?>"></script>
<script type="text/javascript">
    $(function () {
        $('input[type=text], input[type=password], textarea').each (function () {
            placeHolderOut(this);
            resetInput(this);
            $(this).keyup(function () {
                resetInput(this);
            });
            $(this).focus(function () {
                placeHolderIn(this);
                resetInput(this);
            });
            $(this).blur(function () {
                placeHolderOut(this);
                resetInput(this);
            });
        });
    
    });
    // Identify filled field form other
    function resetInput (element) {
        if ($(element).val() != $(element).attr('data-default')) {
            $(element).addClass('input');
        } else {
            $(element).removeClass('input');
        }
    }
    
    // On focus, if the value of the input equals to data-default attribut, set empty
    function placeHolderIn (element) {
        if ($(element).val() ==  $(element).attr('data-default')) {
            $(element).val('');
        }
    }
    
    // On blur, if the value of the input is empty, set to data-default attribut
    function placeHolderOut (element) {
        if ($(element).val() == '' && (typeof $(element).attr('data-default') != 'undefined')) {
            $(element).val($(element).attr('data-default'));
        } else {
            $(element).removeClass('input');
        }
    }
</script>